//
//  ViewController.m
//  TRView
//
//  Created by cry on 2017/8/25.
//  Copyright © 2017年 cry. All rights reserved.
//

#import "ViewController.h"
#import "TRViewMaker.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    
    TRViewMaker *maker = [TRViewMaker maker];
    TRViewType soild = TRViewTypeSoild;
//    TRViewType text = TRViewTypeText;
//    TRViewType image = TRViewTypeImage;
    
    UIColor *red = [UIColor redColor];
    UIColor *blue = [UIColor blueColor];
    UIColor *green = [UIColor greenColor];
    UIColor *white = [UIColor whiteColor];
    UIColor *orange = [UIColor orangeColor];
    UIColor *yellow = [UIColor yellowColor];
    UIColor *purple = [UIColor purpleColor];
    UIColor *clear = [UIColor clearColor];
    
    [maker.addView(soild).color(red).height(200) axisVerticalContains:^(TRViewMaker *maker) {
//        maker.addView(soild).color(clear).height(100);
        [maker.addView(soild).color(orange).height(100) axisHorizontalContains:^(TRViewMaker *maker) {
//            maker.addView(soild).color(clear).height(100);
            [maker.addView(soild).color(yellow).height(100) axisVerticalContains:^(TRViewMaker *maker) {
//                maker.addView(soild).color(clear).height(50);
                [maker.addView(soild).color(green).height(50) axisHorizontalContains:^(TRViewMaker *maker) {
//                    maker.addView(soild).color(clear).height(50);
                    [maker.addView(soild).color(blue).height(50) axisVerticalContains:^(TRViewMaker *maker) {
//                        maker.addView(soild).color(clear).height(25);
                        [maker.addView(soild).color(purple).height(25) axisHorizontalContains:^(TRViewMaker *maker) {
//                            maker.addView(soild).color(clear).height(25);
                            maker.addView(soild).color(white).height(25);
                        }];
                    }];
                }];
            }];
        }];
    }];
    
    UIView *view = maker.toUIView();
    view.frame = CGRectMake(64, 64, 200, 200);
    [self.view addSubview:view];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
